<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test::Tester - Ease testing test modules built with Test::Builder - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Test::Tester">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Tester.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Test::Tester">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Test::Tester">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Test::Tester">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Test::Tester">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Test::Tester">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Test::Tester">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Test::Tester">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Test::Tester">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Test::Tester">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Test::Tester">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Test::Tester">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Test::Tester">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Test::Tester">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Test::Tester">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Test::Tester">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Test::Tester">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Test::Tester">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Test::Tester">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Test::Tester">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Test::Tester">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Test::Tester">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Test::Tester">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Test::Tester">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Test::Tester">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Test::Tester">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Test::Tester">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Test::Tester">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Test::Tester">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Test::Tester">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Test::Tester">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Test::Tester">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Test::Tester">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Test::Tester">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Test::Tester">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Test::Tester">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Test::Tester">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Test::Tester">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Test::Tester">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Test::Tester">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Test::Tester">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Test::Tester">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Test::Tester">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Test::Tester">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Test::Tester">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Test::Tester">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Test::Tester">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Test::Tester">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Test::Tester">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Test::Tester">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Test::Tester">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Test::Tester">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Test::Tester">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Test::Tester">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Test::Tester">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Test::Tester">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Test::Tester">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Test::Tester">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Test::Tester">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Test::Tester">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Test::Tester">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Test::Tester">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Test::Tester">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Test::Tester">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Test::Tester">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Test::Tester">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Test::Tester">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Test::Tester">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Test::Tester">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Test::Tester">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Test::Tester">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Test::Tester">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Test::Tester">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Test::Tester">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Test::Tester">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Test::Tester">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Test::Tester">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Test::Tester">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Test::Tester">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Test::Tester">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Test::Tester">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Tester.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Test::Tester">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Test::Tester">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Test::Tester">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Test::Tester">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Test::Tester">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Test::Tester">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Test::Tester">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Test::Tester">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Test::Tester">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Test::Tester">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Test::Tester">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Test::Tester">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Test::Tester">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Test::Tester">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Test::Tester">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Test::Tester">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Test::Tester">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Test::Tester">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Test::Tester">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Test::Tester">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Test::Tester">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Test::Tester">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Test::Tester">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Test::Tester">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Test::Tester">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Test::Tester">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Test::Tester">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Test::Tester">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Test::Tester">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Test::Tester">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Test::Tester">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Test::Tester">5.35.1</a>
          <a class="dropdown-item active" href="./Test::Tester.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Tester.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Test::Tester.html">Test::Tester</a>
          <div id="more">
            (<a href="./Test::Tester.txt">source</a>,
            <a href="https://metacpan.org/pod/Test::Tester">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.302183</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#HOW-TO-USE-(THE-EASY-WAY)">HOW TO USE (THE EASY WAY)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#HOW-TO-USE-(THE-HARD-WAY)">HOW TO USE (THE HARD WAY)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#TEST-RESULTS">TEST RESULTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#SPACES-AND-TABS">SPACES AND TABS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#COLOUR">COLOUR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#EXPORTED-FUNCTIONS">EXPORTED FUNCTIONS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#($premature,-@results)-=-run_tests(%5C&amp;test_sub)">($premature, @results) = run_tests(\&amp;test_sub)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#cmp_result(%5C%25result,-%5C%25expect,-$name)">cmp_result(\%result, \%expect, $name)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#cmp_results(%5C@results,-%5C@expects,-$name)">cmp_results(\@results, \@expects, $name)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#($premature,-@results)-=-check_tests(%5C&amp;test_sub,-%5C@expects,-$name)">($premature, @results) = check_tests(\&amp;test_sub, \@expects, $name)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#($premature,-@results)-=-check_test(%5C&amp;test_sub,-%5C%25expect,-$name)">($premature, @results) = check_test(\&amp;test_sub, \%expect, $name)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#show_space()">show_space()</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#HOW-IT-WORKS">HOW IT WORKS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#CAVEATS">CAVEATS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Tester.html#LICENSE">LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Test::Tester.html#NAME">#</a>NAME</h1>

<p>Test::Tester - Ease testing test modules built with Test::Builder</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Test::Tester.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Test::Tester tests =&gt; 6;

use Test::MyStyle;

check_test(
  sub {
    is_mystyle_eq(&quot;this&quot;, &quot;that&quot;, &quot;not eq&quot;);
  },
  {
    ok =&gt; 0, # expect this to fail
    name =&gt; &quot;not eq&quot;,
    diag =&gt; &quot;Expected: &#39;this&#39;\nGot: &#39;that&#39;&quot;,
  }
);</code></pre>

<p>or</p>

<pre><code>use Test::Tester tests =&gt; 6;

use Test::MyStyle;

check_test(
  sub {
    is_mystyle_qr(&quot;this&quot;, &quot;that&quot;, &quot;not matching&quot;);
  },
  {
    ok =&gt; 0, # expect this to fail
    name =&gt; &quot;not matching&quot;,
    diag =&gt; qr/Expected: &#39;this&#39;\s+Got: &#39;that&#39;/,
  }
);</code></pre>

<p>or</p>

<pre><code>use Test::Tester;

use Test::More tests =&gt; 3;
use Test::MyStyle;

my ($premature, @results) = run_tests(
  sub {
    is_database_alive(&quot;dbname&quot;);
  }
);

# now use Test::More::like to check the diagnostic output

like($results[0]-&gt;{diag}, &quot;/^Database ping took \\d+ seconds$&quot;/, &quot;diag&quot;);</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Test::Tester.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>If you have written a test module based on Test::Builder then Test::Tester allows you to test it with the minimum of effort.</p>

<h1 id="HOW-TO-USE-(THE-EASY-WAY)"><a class="permalink" href="./Test::Tester.html#HOW-TO-USE-(THE-EASY-WAY)">#</a><a id="HOW"></a><a id="HOW-TO-USE-THE-EASY-WAY"></a>HOW TO USE (THE EASY WAY)</h1>

<p>From version 0.08 Test::Tester no longer requires you to included anything special in your test modules. All you need to do is</p>

<pre><code>use Test::Tester;</code></pre>

<p>in your test script <b>before</b> any other Test::Builder based modules and away you go.</p>

<p>Other modules based on Test::Builder can be used to help with the testing. In fact you can even use functions from your module to test other functions from the same module (while this is possible it is probably not a good idea, if your module has bugs, then using it to test itself may give the wrong answers).</p>

<p>The easiest way to test is to do something like</p>

<pre><code>check_test(
  sub { is_mystyle_eq(&quot;this&quot;, &quot;that&quot;, &quot;not eq&quot;) },
  {
    ok =&gt; 0, # we expect the test to fail
    name =&gt; &quot;not eq&quot;,
    diag =&gt; &quot;Expected: &#39;this&#39;\nGot: &#39;that&#39;&quot;,
  }
);</code></pre>

<p>this will execute the is_mystyle_eq test, capturing its results and checking that they are what was expected.</p>

<p>You may need to examine the test results in a more flexible way, for example, the diagnostic output may be quite long or complex or it may involve something that you cannot predict in advance like a timestamp. In this case you can get direct access to the test results:</p>

<pre><code>my ($premature, @results) = run_tests(
  sub {
    is_database_alive(&quot;dbname&quot;);
  }
);

like($result[0]-&gt;{diag}, &quot;/^Database ping took \\d+ seconds$&quot;/, &quot;diag&quot;);</code></pre>

<p>or</p>

<pre><code>check_test(
  sub { is_mystyle_qr(&quot;this&quot;, &quot;that&quot;, &quot;not matching&quot;) },
  {
    ok =&gt; 0, # we expect the test to fail
    name =&gt; &quot;not matching&quot;,
    diag =&gt; qr/Expected: &#39;this&#39;\s+Got: &#39;that&#39;/,
  }
);</code></pre>

<p>We cannot predict how long the database ping will take so we use Test::More&#39;s like() test to check that the diagnostic string is of the right form.</p>

<h1 id="HOW-TO-USE-(THE-HARD-WAY)"><a class="permalink" href="./Test::Tester.html#HOW-TO-USE-(THE-HARD-WAY)">#</a><a id="HOW1"></a><a id="HOW-TO-USE-THE-HARD-WAY"></a>HOW TO USE (THE HARD WAY)</h1>

<p><i>This is here for backwards compatibility only</i></p>

<p>Make your module use the Test::Tester::Capture object instead of the Test::Builder one. How to do this depends on your module but assuming that your module holds the Test::Builder object in $Test and that all your test routines access it through $Test then providing a function something like this</p>

<pre><code>sub set_builder
{
  $Test = shift;
}</code></pre>

<p>should allow your test scripts to do</p>

<pre><code>Test::YourModule::set_builder(Test::Tester-&gt;capture);</code></pre>

<p>and after that any tests inside your module will captured.</p>

<h1 id="TEST-RESULTS"><a class="permalink" href="./Test::Tester.html#TEST-RESULTS">#</a><a id="TEST"></a>TEST RESULTS</h1>

<p>The result of each test is captured in a hash. These hashes are the same as the hashes returned by Test::Builder-&gt;details but with a couple of extra fields.</p>

<p>These fields are documented in <a href="./Test::Builder.html">Test::Builder</a> in the details() function</p>

<dl>

<dt id="ok"><a class="permalink" href="./Test::Tester.html#ok">#</a>ok</dt>
<dd>

<p>Did the test pass?</p>

</dd>
<dt id="actual_ok"><a class="permalink" href="./Test::Tester.html#actual_ok">#</a>actual_ok</dt>
<dd>

<p>Did the test really pass? That is, did the pass come from Test::Builder-&gt;ok() or did it pass because it was a TODO test?</p>

</dd>
<dt id="name"><a class="permalink" href="./Test::Tester.html#name">#</a>name</dt>
<dd>

<p>The name supplied for the test.</p>

</dd>
<dt id="type"><a class="permalink" href="./Test::Tester.html#type">#</a>type</dt>
<dd>

<p>What kind of test? Possibilities include, skip, todo etc. See <a href="./Test::Builder.html">Test::Builder</a> for more details.</p>

</dd>
<dt id="reason"><a class="permalink" href="./Test::Tester.html#reason">#</a>reason</dt>
<dd>

<p>The reason for the skip, todo etc. See <a href="./Test::Builder.html">Test::Builder</a> for more details.</p>

</dd>
</dl>

<p>These fields are exclusive to Test::Tester.</p>

<dl>

<dt id="diag"><a class="permalink" href="./Test::Tester.html#diag">#</a>diag</dt>
<dd>

<p>Any diagnostics that were output for the test. This only includes diagnostics output <b>after</b> the test result is declared.</p>

<p>Note that Test::Builder ensures that any diagnostics end in a \n and it in earlier versions of Test::Tester it was essential that you have the final \n in your expected diagnostics. From version 0.10 onward, Test::Tester will add the \n if you forgot it. It will not add a \n if you are expecting no diagnostics. See below for help tracking down hard to find space and tab related problems.</p>

</dd>
<dt id="depth"><a class="permalink" href="./Test::Tester.html#depth">#</a>depth</dt>
<dd>

<p>This allows you to check that your test module is setting the correct value for $Test::Builder::Level and thus giving the correct file and line number when a test fails. It is calculated by looking at caller() and $Test::Builder::Level. It should count how many subroutines there are before jumping into the function you are testing. So for example in</p>

<pre><code>run_tests( sub { my_test_function(&quot;a&quot;, &quot;b&quot;) } );</code></pre>

<p>the depth should be 1 and in</p>

<pre><code>sub deeper { my_test_function(&quot;a&quot;, &quot;b&quot;) }

run_tests(sub { deeper() });</code></pre>

<p>depth should be 2, that is 1 for the sub {} and one for deeper(). This might seem a little complex but if your tests look like the simple examples in this doc then you don&#39;t need to worry as the depth will always be 1 and that&#39;s what Test::Tester expects by default.</p>

<p><b>Note</b>: if you do not specify a value for depth in check_test() then it automatically compares it against 1, if you really want to skip the depth test then pass in undef.</p>

<p><b>Note</b>: depth will not be correctly calculated for tests that run from a signal handler or an END block or anywhere else that hides the call stack.</p>

</dd>
</dl>

<p>Some of Test::Tester&#39;s functions return arrays of these hashes, just like Test::Builder-&gt;details. That is, the hash for the first test will be array element 1 (not 0). Element 0 will not be a hash it will be a string which contains any diagnostic output that came before the first test. This should usually be empty, if it&#39;s not, it means something output diagnostics before any test results showed up.</p>

<h1 id="SPACES-AND-TABS"><a class="permalink" href="./Test::Tester.html#SPACES-AND-TABS">#</a><a id="SPACES"></a>SPACES AND TABS</h1>

<p>Appearances can be deceptive, especially when it comes to emptiness. If you are scratching your head trying to work out why Test::Tester is saying that your diagnostics are wrong when they look perfectly right then the answer is probably whitespace. From version 0.10 on, Test::Tester surrounds the expected and got diag values with single quotes to make it easier to spot trailing whitespace. So in this example</p>

<pre><code class="plaintext"># Got diag (5 bytes):
# &#39;abcd &#39;
# Expected diag (4 bytes):
# &#39;abcd&#39;</code></pre>

<p>it is quite clear that there is a space at the end of the first string. Another way to solve this problem is to use colour and inverse video on an ANSI terminal, see below COLOUR below if you want this.</p>

<p>Unfortunately this is sometimes not enough, neither colour nor quotes will help you with problems involving tabs, other non-printing characters and certain kinds of problems inherent in Unicode. To deal with this, you can switch Test::Tester into a mode whereby all &quot;tricky&quot; characters are shown as \{xx}. Tricky characters are those with ASCII code less than 33 or higher than 126. This makes the output more difficult to read but much easier to find subtle differences between strings. To turn on this mode either call <code>show_space()</code> in your test script or set the <code>TESTTESTERSPACE</code> environment variable to be a true value. The example above would then look like</p>

<pre><code class="plaintext"># Got diag (5 bytes):
# abcd\x{20}
# Expected diag (4 bytes):
# abcd</code></pre>

<h1 id="COLOUR"><a class="permalink" href="./Test::Tester.html#COLOUR">#</a>COLOUR</h1>

<p>If you prefer to use colour as a means of finding tricky whitespace characters then you can set the <code>TESTTESTCOLOUR</code> environment variable to a comma separated pair of colours, the first for the foreground, the second for the background. For example &quot;white,red&quot; will print white text on a red background. This requires the Term::ANSIColor module. You can specify any colour that would be acceptable to the Term::ANSIColor::color function.</p>

<p>If you spell colour differently, that&#39;s no problem. The <code>TESTTESTERCOLOR</code> variable also works (if both are set then the British spelling wins out).</p>

<h1 id="EXPORTED-FUNCTIONS"><a class="permalink" href="./Test::Tester.html#EXPORTED-FUNCTIONS">#</a><a id="EXPORTED"></a>EXPORTED FUNCTIONS</h1>

<h3 id="($premature,-@results)-=-run_tests(\&amp;test_sub)"><a class="permalink" href="./Test::Tester.html#($premature,-@results)-=-run_tests(%5C&amp;test_sub)">#</a><a id="premature-results-run_tests-test_sub"></a>($premature, @results) = run_tests(\&amp;test_sub)</h3>

<p>\&amp;test_sub is a reference to a subroutine.</p>

<p>run_tests runs the subroutine in $test_sub and captures the results of any tests inside it. You can run more than 1 test inside this subroutine if you like.</p>

<p>$premature is a string containing any diagnostic output from before the first test.</p>

<p>@results is an array of test result hashes.</p>

<h3 id="cmp_result(\%result,-\%expect,-$name)"><a class="permalink" href="./Test::Tester.html#cmp_result(%5C%25result,-%5C%25expect,-$name)">#</a><a id="cmp_result"></a><a id="cmp_result-result-expect-name"></a>cmp_result(\%result, \%expect, $name)</h3>

<p>\%result is a ref to a test result hash.</p>

<p>\%expect is a ref to a hash of expected values for the test result.</p>

<p>cmp_result compares the result with the expected values. If any differences are found it outputs diagnostics. You may leave out any field from the expected result and cmp_result will not do the comparison of that field.</p>

<h3 id="cmp_results(\@results,-\@expects,-$name)"><a class="permalink" href="./Test::Tester.html#cmp_results(%5C@results,-%5C@expects,-$name)">#</a><a id="cmp_results"></a><a id="cmp_results-results-expects-name"></a>cmp_results(\@results, \@expects, $name)</h3>

<p>\@results is a ref to an array of test results.</p>

<p>\@expects is a ref to an array of hash refs.</p>

<p>cmp_results checks that the results match the expected results and if any differences are found it outputs diagnostics. It first checks that the number of elements in \@results and \@expects is the same. Then it goes through each result checking it against the expected result as in cmp_result() above.</p>

<h3 id="($premature,-@results)-=-check_tests(\&amp;test_sub,-\@expects,-$name)"><a class="permalink" href="./Test::Tester.html#($premature,-@results)-=-check_tests(%5C&amp;test_sub,-%5C@expects,-$name)">#</a><a id="premature-results-check_tests-test_sub-expects-name"></a>($premature, @results) = check_tests(\&amp;test_sub, \@expects, $name)</h3>

<p>\&amp;test_sub is a reference to a subroutine.</p>

<p>\@expect is a ref to an array of hash refs which are expected test results.</p>

<p>check_tests combines run_tests and cmp_tests into a single call. It also checks if the tests died at any stage.</p>

<p>It returns the same values as run_tests, so you can further examine the test results if you need to.</p>

<h3 id="($premature,-@results)-=-check_test(\&amp;test_sub,-\%expect,-$name)"><a class="permalink" href="./Test::Tester.html#($premature,-@results)-=-check_test(%5C&amp;test_sub,-%5C%25expect,-$name)">#</a><a id="premature-results-check_test-test_sub-expect-name"></a>($premature, @results) = check_test(\&amp;test_sub, \%expect, $name)</h3>

<p>\&amp;test_sub is a reference to a subroutine.</p>

<p>\%expect is a ref to an hash of expected values for the test result.</p>

<p>check_test is a wrapper around check_tests. It combines run_tests and cmp_tests into a single call, checking if the test died. It assumes that only a single test is run inside \&amp;test_sub and include a test to make sure this is true.</p>

<p>It returns the same values as run_tests, so you can further examine the test results if you need to.</p>

<h3 id="show_space()"><a class="permalink" href="./Test::Tester.html#show_space()">#</a><a id="show_space"></a>show_space()</h3>

<p>Turn on the escaping of characters as described in the SPACES AND TABS section.</p>

<h1 id="HOW-IT-WORKS"><a class="permalink" href="./Test::Tester.html#HOW-IT-WORKS">#</a><a id="HOW2"></a>HOW IT WORKS</h1>

<p>Normally, a test module (let&#39;s call it Test:MyStyle) calls Test::Builder-&gt;new to get the Test::Builder object. Test::MyStyle calls methods on this object to record information about test results. When Test::Tester is loaded, it replaces Test::Builder&#39;s new() method with one which returns a Test::Tester::Delegate object. Most of the time this object behaves as the real Test::Builder object. Any methods that are called are delegated to the real Test::Builder object so everything works perfectly. However once we go into test mode, the method calls are no longer passed to the real Test::Builder object, instead they go to the Test::Tester::Capture object. This object seems exactly like the real Test::Builder object, except, instead of outputting test results and diagnostics, it just records all the information for later analysis.</p>

<h1 id="CAVEATS"><a class="permalink" href="./Test::Tester.html#CAVEATS">#</a>CAVEATS</h1>

<p>Support for calling Test::Builder-&gt;note is minimal. It&#39;s implemented as an empty stub, so modules that use it will not crash but the calls are not recorded for testing purposes like the others. Patches welcome.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Test::Tester.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="./Test::Builder.html">Test::Builder</a> the source of testing goodness. <a href="./Test::Builder::Tester.html">Test::Builder::Tester</a> for an alternative approach to the problem tackled by Test::Tester - captures the strings output by Test::Builder. This means you cannot get separate access to the individual pieces of information and you must predict <b>exactly</b> what your test will output.</p>

<h1 id="AUTHOR"><a class="permalink" href="./Test::Tester.html#AUTHOR">#</a>AUTHOR</h1>

<p>This module is copyright 2005 Fergal Daly &lt;fergal@esatclear.ie&gt;, some parts are based on other people&#39;s work.</p>

<p>Plan handling lifted from Test::More. written by Michael G Schwern &lt;schwern@pobox.com&gt;.</p>

<p>Test::Tester::Capture is a cut down and hacked up version of Test::Builder. Test::Builder was written by chromatic &lt;chromatic@wgz.org&gt; and Michael G Schwern &lt;schwern@pobox.com&gt;.</p>

<h1 id="LICENSE"><a class="permalink" href="./Test::Tester.html#LICENSE">#</a>LICENSE</h1>

<p>Under the same license as Perl itself</p>

<p>See http://www.perl.com/perl/misc/Artistic.html</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
